home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / fmdrgdrp / opt2 / invent.exe / FORMMGR.BAS < prev    next >
Encoding:
BASIC Source File  |  1993-08-20  |  1.2 KB  |  54 lines

  1. ' A formItem is used to keep track of information about
  2. ' a specific form instance.
  3.  
  4. Type FormItem
  5.     fiUsed As Integer   ' TRUE if occupied
  6.     fiFileName As String
  7.     fiTable As String
  8. End Type
  9.  
  10. Dim LastAlloc As Integer
  11.  
  12. Function FormAlloc (fia() As FormItem) As Integer
  13.     
  14.     ' Allocate a form ... assumes that one is available.
  15.  
  16.     For i% = LBound(fia) To UBound(fia)
  17.         If Not fia(i%).fiUsed Then
  18.             fia(i%).fiUsed = True
  19.             FormAlloc = i%
  20.             LastAlloc = i%
  21.             Exit Function
  22.         End If
  23.     Next
  24. End Function
  25.  
  26. Function FormAvail (fia() As FormItem) As Integer
  27.     
  28.     ' Checks to see if any form slots are available in
  29.     ' the form array.
  30.  
  31.     For i% = LBound(fia) To UBound(fia)
  32.         If Not fia(i%).fiUsed Then
  33.             FormAvail = True
  34.             Exit Function
  35.         End If
  36.     Next
  37.     FormAvail = False
  38. End Function
  39.  
  40. Sub FormFree (fi As FormItem)
  41.     fi.fiUsed = False
  42. End Sub
  43.  
  44. Sub FormInit (fia() As FormItem)
  45.     For i% = LBound(fia) To UBound(fia)
  46.         fia(i%).fiUsed = False
  47.     Next
  48. End Sub
  49.  
  50. Function FormLastAlloc () As Integer
  51.     FormLastAlloc = LastAlloc
  52. End Function
  53.  
  54.